﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.ComponentModel;
using System.Drawing.Design;

namespace UIPrototyper
{
    class ScreenProperties : Property, IChanged, INotifyPropertyChanged
    {
        private Screen screen;

        public ScreenProperties(Screen pScreen)
        {
            this.screen = pScreen;
        }

        [DescriptionAttribute("O ID da Tela."),
                CategoryAttribute("Tela")]
        public string ID
        {
            get { return this.screen.ID; }
        }

        [DescriptionAttribute("O nome da Tela."),
        CategoryAttribute("Tela")]
        public string Name
        {
            get { return this.screen.Name; }
            set
            {
                this.screen.Name = value;
                LaunchChangedEvent(this.screen);

                if (PropertyChanged != null)
                {
                    PropertyChangedEventArgs e = new PropertyChangedEventArgs("Name");
                    PropertyChanged(this, e);
                }
            }
        }

        [Browsable(false)]
        public override string Nome
        {
            get { return this.screen.Name; }
            set { this.screen.Name = value; LaunchChangedEvent(this.screen); }
        }

        [DescriptionAttribute("O Tipo da Tela."),
        CategoryAttribute("Tela")]
        public ScreenType MeuTipo
        {
            get { return this.screen.MyType; }
            set { this.screen.MyType = value; }
        }

        #region IChanged Members

        public event ChangedHandler iChanged;

        public void LaunchChangedEvent(IChanged pChangedObject)
        {
            if (iChanged != null)
            {
                iChanged(pChangedObject);
            }
        }

        #endregion

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion
    }
}
